home *** CD-ROM | disk | FTP | other *** search
/ Holt Researcher: American History / Holt Researcher: American History.iso / pc / modules / grphwiz.dxr / 00135_save button.ls < prev    next >
Encoding:
Text File  |  2000-01-14  |  3.3 KB  |  104 lines

  1. property ancestor, pMIAW
  2. global gEnvironObj, gGraph, gInconsistantAlert, gGraphClosedAlert, gIsAlertMessagesOn, gIsRolloverTextOn, gOKAlert, gGraphWizard
  3.  
  4. on new me, buttonName, castName, theChannel, theStageLoc, theBalloonChannel, theBalloonLoc, descendant
  5.   if objectp(descendant) then
  6.     ancestor = new(script("button with balloon"), buttonName, castName, theChannel, theStageLoc, theBalloonChannel, theBalloonLoc, descendant)
  7.   else
  8.     ancestor = new(script("button with balloon"), buttonName, castName, theChannel, theStageLoc, theBalloonChannel, theBalloonLoc, me)
  9.   end if
  10.   cursor = [member("point hand", "graph.cst"), member("point hand mask", "graph.cst")]
  11.   set the cursor of sprite the pChannel of me to cursor
  12.   return me
  13. end
  14.  
  15. on setMIAW me, miaw
  16.   pMIAW = miaw
  17.   return me
  18. end
  19.  
  20. on performFunction me
  21.   tell the stage
  22.     playSFX(5)
  23.   end tell
  24.   isHiLoOK = 1
  25.   if not getaProp(gGraph, #pIsAutoRange) then
  26.     oldDelimiter = the itemDelimiter
  27.     the itemDelimiter = RETURN
  28.     loStr = stripCommas(item 1 of the text of field "low field")
  29.     hiStr = stripCommas(item 1 of the text of field "high field")
  30.     the itemDelimiter = oldDelimiter
  31.     if not ((loStr = EMPTY) or (loStr = " ") or (hiStr = EMPTY) or (hiStr = " ")) then
  32.       min = value(loStr)
  33.       max = value(hiStr)
  34.     end if
  35.     if voidp(min) or voidp(max) then
  36.       isHiLoOK = 0
  37.       tell the stage
  38.         openAlertWindow("okalert", rect(0, 0, 320, 171), "Invalid values were entered for the y-axis range. Enter numbers for the highest and lowest y-values or choose computer generated y-axis range.")
  39.       end tell
  40.     else
  41.       if min >= max then
  42.         isHiLoOK = 0
  43.         tell the stage
  44.           openAlertWindow("okalert", rect(0, 0, 320, 171), "The highest value must be larger than the lowest value.")
  45.         end tell
  46.       else
  47.         setaProp(gGraph, #pMin, min)
  48.         setaProp(gGraph, #pMax, max)
  49.         setIntervalList(gGraphWizard, getIntervalList(gGraph))
  50.       end if
  51.     end if
  52.   end if
  53.   if isHiLoOK then
  54.     oldDelimiter = the itemDelimiter
  55.     the itemDelimiter = RETURN
  56.     set the text of field "graph wizard title" to "Graph Wizard:" && item 1 of the text of field "title field"
  57.     set the text of field "domain" to item 1 of the text of field "x label field"
  58.     set the text of field "range" to item 1 of the text of field "y label field"
  59.     the itemDelimiter = oldDelimiter
  60.     if windowPresent("Graph") then
  61.       if not getaProp(gGraph, #pIsConsistant) then
  62.         if gIsAlertMessagesOn then
  63.           tell the stage
  64.             openAlertWindow("datntsam", rect(0, 0, 320, 211))
  65.           end tell
  66.         else
  67.           pathAndName = saveData(gGraph)
  68.           if pathAndName <> EMPTY then
  69.             saveGraph(gGraph, pathAndName)
  70.           end if
  71.         end if
  72.       else
  73.         pathAndName = saveData(gGraph)
  74.         if pathAndName <> EMPTY then
  75.           saveGraph(gGraph, pathAndName)
  76.         end if
  77.       end if
  78.     else
  79.       if gIsAlertMessagesOn then
  80.         tell the stage
  81.           openAlertWindow("svdtonly", rect(0, 0, 320, 211))
  82.         end tell
  83.       else
  84.         saveData(gGraph)
  85.       end if
  86.     end if
  87.   end if
  88.   return me
  89. end
  90.  
  91. on performRolloverFunction me
  92.   if gIsRolloverTextOn then
  93.     performRolloverFunction(ancestor)
  94.   end if
  95.   return me
  96. end
  97.  
  98. on performRolloffFunction me
  99.   if gIsRolloverTextOn then
  100.     performRolloffFunction(ancestor)
  101.   end if
  102.   return me
  103. end
  104.